在客户端配置TNS测试报错ORA-12170:TNS:连接超时
-A RH-Firewall-1-INPUT -p ah -j ACCEPT
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1)))
Unloading iptables modules: [ OK ]
在Red Hat Enterprise Linux Server Releae 5.5 成功安装ORACLE 10g 后,在客户端配置TNS后,测试是否可以连接到数据块服务器,结果报错: ORA-12170:TNS:连接超时
Listener Parameter File /database/oracle/product/dbhome/network/admin/listener.ora
C:\Users\kerry>tnsping 172.20.32.79
~
[root@wgods sysconfig]# service iptables save
-A RH-Firewall-1-INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
TNS-12535: TNS: 操作超时
尝试连接 (DESCRIPTION=(CONNECT_DATA=(SERVICE_NAME=))(ADDRESS=(PROTOCOL=TCP)(HOST=172.20.32.79)(PORT=1521)))
Service "gspXDB" has 1 instance(s).
1:首先检查网络是否能ping通,如下所示,网络是畅通的
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:25
:RH-Firewall-1-INPUT - [0:0]
2:检查TNS配置(TNS配置也没有问题)
(CONNECT_DATA=
~
ACCEPT udp -- 0.0.0.0/0 224.0.0.251 udp dpt:5353
-A RH-Firewall-1-INPUT -i lo -j ACCEPT
Services Summary...
SNMP OFF
(SERVICE_NAME = gsp)
:FORWARD ACCEPT [0:0]
Loading additional iptables modules: ip_conntrack_netbios_ns ip_conntrack_ftp [ OK ]
Start Date 14-DEC-2012 13:15:28
Instance "gsp", status READY, has 1 handler(s) for this service...
已使用 EZCONNECT 适配器来解析别名
-A RH-Firewall-1-INPUT -p tcp -m tcp --dport 631 -j ACCEPT
Chain RH-Firewall-1-INPUT (2 references)
(ADDRESS =(PROTOCOL = TCP)(HOST = 172.20.36.79)(PORT = 1521))
~
Chain OUTPUT (policy ACCEPT)
# Completed on Fri Dec 14 17:03:58 2012
Chain INPUT (policy ACCEPT)
2:修改iptables,开放1521端口,允许1521端口被连接
2.3 保存新增的规则,以免下次重启机器后,配置规则失效
)
-A INPUT -j RH-Firewall-1-INPUT
Uptime 0 days 2 hr. 35 min. 45 sec
[root@wgods sysconfig]# service iptables restart
对于防火墙问题,我们可以有两种解决方案:
*filter
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:22
Setting chains to policy ACCEPT: filter [ OK ]
[root@wgods ~]# service iptables stop
Setting chains to policy ACCEPT: filter [ OK ]
[root@wgods sysconfig]# vi iptables
-A RH-Firewall-1-INPUT -p udp -m udp --dport 631 -j ACCEPT
)
Unloading iptables modules: [ OK ]
[root@wgods sysconfig]#
target prot opt source destination
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:21
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))
COMMIT
"iptables" 24L, 1212C written
-A RH-Firewall-1-INPUT -p tcp -m state --state NEW -m tcp --dport 1521 -j ACCEPT
-A RH-Firewall-1-INPUT -p tcp -m state --state NEW -m tcp --dport 23 -j ACCEPT
(DESCRIPTION =
-A RH-Firewall-1-INPUT -p tcp -m state --state NEW -m tcp --dport 21 -j ACCEPT
Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
------------------------
LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 14-DEC-2012 15:51:13
The command completed successfully
:OUTPUT ACCEPT [1749:243629]
ACCEPT esp -- 0.0.0.0/0 0.0.0.0/0
Copyright (c) 1991, 2005, Oracle. All rights reserved.
-A RH-Firewall-1-INPUT -j REJECT --reject-with icmp-host-prohibited
ACCEPT udp -- 0.0.0.0/0 0.0.0.0/0 udp dpt:631
Service "gsp_XPT" has 1 instance(s).
Listening Endpoints Summary...
已使用的参数文件:
E:\app\kerry\product\11.2.0\dbhome_1\network\admin\sqlnet.ora
-A RH-Firewall-1-INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
Trace Level off
Copyright (c) 1997, 2010, Oracle. All rights reserved.
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:1521
:INPUT ACCEPT [0:0]
ACCEPT ah -- 0.0.0.0/0 0.0.0.0/0
Service "gsp" has 2 instance(s).
REJECT all -- 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited
-A RH-Firewall-1-INPUT -p esp -j ACCEPT
4:使用tnsping命令检查,报TNS-12535: TNS: 操作超时,这时我们可以肯定是防火墙的问题了
# Generated by iptables-save v1.3.5 on Fri Dec 14 17:03:58 2012
-A RH-Firewall-1-INPUT -p icmp -m icmp --icmp-type any -j ACCEPT
Chain FORWARD (policy ACCEPT)
-A RH-Firewall-1-INPUT -d 224.0.0.251 -p udp -m udp --dport 5353 -j ACCEPT
Flushing firewall rules: [ OK ]
Instance "gsp", status READY, has 1 handler(s) for this service...
Listener Log File /database/oracle/product/dbhome/network/log/listener.log
target prot opt source destination
Applying iptables firewall rules: [ OK ]
Instance "gsp", status READY, has 1 handler(s) for this service...
Instance "gsp", status UNKNOWN, has 1 handler(s) for this service...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=wgods)(PORT=1521)))
Alias LISTENER
-A FORWARD -j RH-Firewall-1-INPUT
从客户端用PL/SQL Developer连接数据库,问题解决。 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:23
RH-Firewall-1-INPUT all -- 0.0.0.0/0 0.0.0.0/0
Service "PLSExtProc" has 1 instance(s).
ACCEPT all -- 0.0.0.0/0 0.0.0.0/0
2.1 编辑iptables文件,添加-A RH-Firewall-1-INPUT -p tcp -m state --state NEW -m tcp --dport 1521 -j ACCEPT记录。
ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED
Saving firewall rules to /etc/sysconfig/iptables: [ OK ]
2.2 重启iptables服务
target prot opt source destination
~
ACCEPT icmp -- 0.0.0.0/0 0.0.0.0/0 icmp type 255
[oracle@wgods ~]$ lsnrctl status
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:631
2.4 查看1521端口是否开放,允许连接(见红色部分)
[root@wgods sysconfig]# iptables -L -n
1:关闭防火墙(这种方案不怎么好,关闭防火墙,会带来许多安全隐患)
STATUS of the LISTENER
TNS Ping Utility for 32-bit Windows: Version 11.2.0.1.0 - Production on 14-12月-2012 15:47:15
GSP =
Flushing firewall rules: [ OK ]
3:查看服务器监听服务是否启动
target prot opt source destination
-A RH-Firewall-1-INPUT -p tcp -m state --state NEW -m tcp --dport 25 -j ACCEPT
Version TNSLSNR for Linux: Version 10.2.0.1.0 - Production
~
(SERVER = DEDICATED)
Security ON: Local OS Authentication
相关热词: 配置
本站内容来源于网络,如有侵权请与我们联系,我们会及时删除,我们深感抱歉!
注:本站所有信息仅供用于网络技术学习参考,学习中请遵循相关法律法规!
本文地址: https://v30.fanwenzhu.com/sql/oracle/3818.shtml
相关文章
热门TAG
win10 ecshop 主机 阿里云 解决 配置 C# C++ 解析 SQL语句 命令 Go语言 方法 CSS3 HTML5 CSS win7 MSSQL 服务器配置 IIS7.5 IIS7 IIS6 IIS CentOS 7 Linux oracle数据库 oracle phpcms discuz discuz教程最新文章
-
是因为scan的IP问题补占用
时间:2021-01-20
-
还你一个干净的model 2、功
时间:2021-01-20
-
既然 ROWNUM 列并不是真实存
时间:2021-01-20
-
Real Application Clusters
时间:2021-01-20
-
在tools-preferences-connection(
时间:2021-01-20
-
Windows Sever 2012下Oracle 12c安
时间:2021-01-10
-
Oracle安装监听器错误的解
时间:2021-01-07
-
oracle远程连接服务器数据
时间:2021-01-07
热门文章
-
Oracle存储过程编程详解
时间:2020-12-07
-
Azure Queue Storage 基本用法 Azure Storage 之
时间:2020-12-26
-
win10下oracle 11g安装图文教程
时间:2020-12-25
-
oracle 数据库学习 基本结构介绍
时间:2020-12-13
-
Azure File Storage 基本用法 Azure Storage 之 F
时间:2020-12-26
-
windows使用sqlpus连接oracle 数据库的教程图
时间:2020-12-25
-
Window下Oracle Database 11g 发行版2安装教程
时间:2020-12-29
-
Oracle解锁的方式介绍
时间:2020-12-14
-
Oracle 12c Study之Installer Oracle
时间:2021-01-06
-
linux下oracle设置开机自启动实现方法
时间:2020-12-13
